package zpf;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName: ConsumerMovieRibbonHystrixApplication
 * @Description: 电影 Ribbon 微服务集成 Hystrix 断路器实现失败快速响应，达到熔断效果
 * * 注解 EnableCircuitBreaker 表明需要集成断路器模块
 * @Autor: ZPF
 * @Date: 2021/1/14 16:00
 **/
@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker
public class ConsumerMovieRibbonHystrixApplication {

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(ConsumerMovieRibbonHystrixApplication.class, args);
        System.out.println("【电影微服务-Hystrix】已启动.");
    }
}